package com.fxp.project.jiuselu.web.business.v1.controller.userbank;


import com.fxp.project.jiuselu.web.base.controller.BaseController;
import com.fxp.project.jiuselu.web.business.v1.request.user.CustomManagerByUserId;
import com.fxp.project.jiuselu.web.domain.CommonResult;
import com.fxp.project.jiuselu.web.models.userbank.qo.BankCardSaveQo;
import com.fxp.project.jiuselu.web.models.userbank.service.IJslUserBankCardInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Jason.Wang
 * @since 2022-01-09
 */
@RestController
@RequestMapping("/v1/userbank")
public class JslUserBankCardInfoController extends BaseController {


    @Autowired
    private IJslUserBankCardInfoService iJslUserBankCardInfoService ;


    @PostMapping("/save")
    @CrossOrigin
    public CommonResult save(@RequestBody @Validated BankCardSaveQo bankCardSaveQo) throws Exception {
        iJslUserBankCardInfoService.saveUserBankCard(bankCardSaveQo,super.getCurrentUserInfo().getUserId());
        return CommonResult.success("保存成功");
    }
    @PostMapping("/remove")
    @CrossOrigin
    public CommonResult remove(@RequestBody @Validated BankCardSaveQo bankCardSaveQo) throws Exception {
        iJslUserBankCardInfoService.removeById(bankCardSaveQo.getBankCardId());
        return CommonResult.success("删除成功");
    }
}
